package com.twt.config.mybatis.surppot;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: tangwt
 * @date: 2022/5/19 21:33
 * @version:1.0
 **/
public class DataSourceBuildFactory {
    private Map<String,DataSourceBuilder> sourceMap = new HashMap<String,DataSourceBuilder>(4){{
        this.put("druid",new DruidDataSourceBuilder());
    }};

    public DataSourceBuilder getDataSourceBuilder(String dataSourceType){
        if (!sourceMap.containsKey(dataSourceType)){
            throw new RuntimeException("不支持的数据源类型");
        }
        return sourceMap.get(dataSourceType);
    }
}
